/**
 * 
 */
package cl.duocap.refaxion.servicios;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import cl.duocap.refaxion.dao.TallerDAO;
import cl.duocap.refaxion.dto.TallerDTO;
import cl.duocap.refaxion.util.Conexion;

/**
 * @author rentonx
 *
 */
public class TallerService {

	/**
	 * 
	 */
	private  TallerDAO tallerDAO;
	Connection c = null;
	
	public TallerService() {
		try {
			try{
				c = Conexion.connect();

				tallerDAO= new TallerDAO(); 
				tallerDAO.setConexion(c);

			}catch(SQLException sql){
				sql.printStackTrace();
			}finally{
				
			}	
		}catch(Exception ex){
			ex.printStackTrace();
		}

	}
	
	public List<TallerDTO> obtenerTalleres(){
		return tallerDAO.obtenerTalleres();
	}
	
	
	public boolean registrarTallerNuevo(TallerDTO tallerNuevo){
		return tallerDAO.registrarTallerNuevo(tallerNuevo);
	}
	
	public boolean eliminarTaller(int idTaller){
		return tallerDAO.eliminarTaller(idTaller);
	}

	public boolean editarTaller(TallerDTO tallerEditado){
		return tallerDAO.editarTaller(tallerEditado);
	}
	public TallerDTO cargarTallerEditar(int idtaller) {
		return tallerDAO.traerTallerEditar(idtaller);
	}
	/**
	 * @return the tallerDAO
	 */
	public TallerDAO getTallerDAO() {
		return tallerDAO;
	}

	/**
	 * @param tallerDAO the tallerDAO to set
	 */
	public void setTallerDAO(TallerDAO tallerDAO) {
		this.tallerDAO = tallerDAO;
	}

	

}
